package com.sh169.util;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public abstract class BaseHttpFilter implements Filter{

	public static final String SECURITY_SESSION_USER = "security_session_user";
	public static final String SESSION_ATTR_USERNAME = "username";
	public static final String SESSION_ATTR_PASSWORD = "password";
	public static final String REQUEST_ERROR_MESSAGE = "request_error_message";
	public static final String SESSION_TARGET_URL = "session_target_url";
	
	public void init(FilterConfig filterConfig) throws ServletException {
		
	}
	public void destroy() {
		
	}
	public abstract void doFilter(HttpServletRequest request, HttpServletResponse response,
			FilterChain chain) throws IOException, ServletException ;
	
	public void doFilter(ServletRequest request, ServletResponse response,FilterChain filterChain)
		throws IOException, ServletException {
		HttpServletRequest req = (HttpServletRequest) request;
		HttpServletResponse resp = (HttpServletResponse) response;
		doFilter(req, resp,filterChain);
	}
}
